#coding=utf-8
"""
===========================
Author:杭州多测师_周sir
Time:2022/9/15 09:42
website:https://duoceshi.net
===========================
"""
'''
此模块是用来生成测试报告的
'''
import sys
sys.path.append("..")
import time
import unittest
from library.HTMLTestRunnerNew import HTMLTestRunner
from utils.hand_path import *
#定义生成报告的路径和文件
now = time.strftime("%Y-%m-%d-%H-%M-%S")
# print(now)
filename = report_path + "\\" + str(now) + "_api_report.html"
def auto_run():
    discover = unittest.defaultTestLoader.discover(start_dir=testcase_path,
                                                   pattern="test_*.py")
    f = open(filename,"wb")
    runner = HTMLTestRunner(stream=f,
                            title="cms平台接口自动化报告",
                            description="测试用例执行如下：",
                            tester="小周")
    runner.run(discover)
    f.close()
if __name__ == '__main__':
    auto_run()










